//
//  RecTravelNotesTableViewCell.m
//  TravelEveryDay
//
//  Created by dlios on 15-10-16.
//  Copyright (c) 2015年 com.lanou3g. All rights reserved.
//

#import "RecTravelNotesTableViewCell.h"

@implementation RecTravelNotesTableViewCell
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        
        _image = [[UIImageView alloc] initWithFrame:CGRectMake(10 * WIDTH, 0, SCREEN_WIDTH - 25, 200 * HEIGHT)];
        _image.layer.cornerRadius = 5;
        _image.layer.masksToBounds = YES;
        [self.contentView addSubview:_image];
        
        
        _shadowImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH - 25, 200 * HEIGHT)];
        _shadowImage.layer.cornerRadius = 5;
        _shadowImage.layer.masksToBounds = YES;
        [_shadowImage setImage:[UIImage imageNamed:@"shadow.png"]];
        [_image addSubview:_shadowImage];
        
        UIView *blueView = [[UIView alloc] initWithFrame:CGRectMake(10 * WIDTH, 60 * HEIGHT, 5 * WIDTH, 40 * HEIGHT)];
        blueView.layer.cornerRadius = 3.;
        blueView.layer.masksToBounds = YES;
        blueView.backgroundColor = [UIColor colorWithRed:62/255 green:176/255. blue:193/255. alpha:1];
        [_shadowImage addSubview:blueView];
        
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10 * WIDTH, 10 * HEIGHT, _image.frame.size.width - 20 * WIDTH, 40 * HEIGHT)];
        _titleLabel.textColor = [UIColor whiteColor];
        _titleLabel.font = [UIFont boldSystemFontOfSize:20.];
        _titleLabel.shadowColor = [UIColor lightGrayColor];
        _titleLabel.shadowOffset = CGSizeMake(-0.7, -0.7);
        [_shadowImage addSubview:_titleLabel];
        
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(20 * WIDTH, 50 * HEIGHT, 250 * WIDTH, 30 * HEIGHT)];
        _timeLabel.textColor = [UIColor whiteColor];
        _timeLabel.font = [UIFont systemFontOfSize:14.];
        [_shadowImage addSubview:_timeLabel];
        
        _areaLabel = [[UILabel alloc] initWithFrame:CGRectMake(20 * WIDTH, 80 * HEIGHT, 200 * WIDTH, 30 * HEIGHT)];
        _areaLabel.textColor = [UIColor whiteColor];
        _areaLabel.font = [UIFont systemFontOfSize:14.];
        [_shadowImage addSubview:_areaLabel];
        
        _iconImage = [[UIImageView alloc] initWithFrame:CGRectMake(10 * WIDTH, 150 * HEIGHT, 30 * WIDTH, 30 * WIDTH)];
        _iconImage.layer.cornerRadius = 15. * WIDTH;
        _iconImage.layer.masksToBounds = YES;
        [_shadowImage addSubview:_iconImage];
        
        _nameLbael = [[UILabel alloc] initWithFrame:CGRectMake(60 * WIDTH, 150 * HEIGHT, 200 * WIDTH, 30 * HEIGHT)];
        _nameLbael.textColor = [UIColor whiteColor];
        [_shadowImage addSubview:_nameLbael];
        
    }
    return self;
}
-(void)getData:(RecTraverNotesModel *)model
{
    [_image sd_setImageWithURL:[NSURL URLWithString:model.cover_image] placeholderImage:PLACEHOLDERIMAGE];
    _titleLabel.text = model.name;
    _timeLabel.text = [NSString stringWithFormat:@"%@  %@天  %@次浏览",model.last_day,model.day_count,model.view_count];
    _areaLabel.text = model.popular_place_str;
}
-(void)getUserData:(RecTravelNotesUserModel *)model
{
    _nameLbael.text = model.name;
    [_iconImage sd_setImageWithURL:[NSURL URLWithString:model.avatar_l] placeholderImage:PLACEHOLDERIMAGE];
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
